﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

using System.Text;
using System.IO;
using System.Xml;
using System.Data;

using Gift.DAL;
using Gift.Model;


public partial class cn_member_center_user_info : BasePage
{

    readonly DALUser theUser = new DALUser();

    // Methods
    protected void Page_Load(object sender, EventArgs e)
    {
        if (base.LoginUserMember == null)
        {
            base.Response.Redirect("/cn/web_login.html?ru=" + HttpContext.Current.Request.Url.PathAndQuery.Replace("aspx", "html"));
        }
    }

    protected StringBuilder UserInfoBind()
    {
        StringBuilder builder = new StringBuilder();
        try
        {
            if (base.LoginUserMember == null)
            {
                return builder;
            }
            DataTable userById = this.theUser.GetUserById((this.Session["user"] as tbUser).id);
            if (userById.Rows.Count <= 0)
            {
                return builder;
            }
            DataRow row = userById.Rows[0];
            builder.AppendLine("<p><label for=\"txtEmail\">电子邮箱：</label><input id=\"txtEmail\" type=\"text\" value=\"" + row["email"] + "\" /><span id=\"spEmail\">*</span></p>");
            builder.AppendLine("<p><label for=\"txtNickName\">昵称：</label><input id=\"txtNickName\" type=\"text\" value=\"" + row["nickName"] + "\" /></p>");
            if (!Convert.IsDBNull(row["sex"]))
            {
                builder.AppendLine("<p class=\"radio_input\"><label>性别：</label><input id=\"radSex1\" type=\"radio\" name=\"sex\" value=\"1\" " + ((Convert.ToInt32(row["sex"]) == 1) ? "checked='checked'" : "") + " />男<input id=\"radSex0\" type=\"radio\" name=\"sex\" value=\"0\" " + ((Convert.ToInt32(row["sex"]) == 0) ? "checked='checked'" : "") + " />女<span id=\"spSex\">*</span></p>");
            }
            else
            {
                builder.AppendLine("<p class=\"radio_input\"><label>性别：</label><input id=\"radSex1\" type=\"radio\" name=\"sex\" value=\"1\" />男<input id=\"radSex0\" type=\"radio\" name=\"sex\" value=\"0\" />女<span id=\"spSex\">*</span></p>");
            }
            builder.AppendLine("<p><label for=\"txtTelephone\">联系电话：</label><input id=\"txtTelephone\" type=\"text\" value=\"" + row["telephone"] + "\" /><span id=\"spTelephone\"></span></p>");
            builder.AppendLine("<p><label for=\"txtMobile\">手机号码：</label><input id=\"txtMobile\" type=\"text\" value=\"" + row["mobile"] + "\" /><span id=\"spMobile\">* 联系电话和手机号码至少填写一项</span></p>");
            builder.AppendLine("<p><label for=\"txtFax\">传真：</label><input id=\"txtFax\" type=\"text\" value=\"" + row["fax"] + "\" /><span id=\"spFax\"></span></p>");
            builder.AppendLine("<p><label for=\"txtAddress\">联系地址：</label><input id=\"txtAddress\" type=\"text\" value=\"" + row["address"] + "\" /></p>");
            builder.AppendLine("<p><label for=\"txtQQ\">QQ号码：</label><input id=\"txtQQ\" type=\"text\" value=\"" + row["qq"] + "\" /></p>");
            builder.AppendLine("<p><label for=\"txtMSN\">MSN：</label><input id=\"txtMSN\" type=\"text\" value=\"" + row["msn"] + "\" /></p>");
            builder.AppendLine("<p><label for=\"txtWangwang\">阿里旺旺：</label><input id=\"txtWangwang\" type=\"text\" value=\"" + row["wangwang"] + "\" /></p>");
        }
        catch
        {
        }
        return builder;
    }

}